/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.tnmk.worktime.service.filter;

import org.tnmk.common.util.Filter;
import org.joda.time.DateTime;
import org.tnmk.worktime.utils.TimePeriodUtils;

/**
 * Filter time must be in the same week with root.
 *
 * @author tnmkhoi
 */
public class MonthTimeFilter implements Filter<DateTime> {

  private DateTime root;

  public MonthTimeFilter(DateTime root) {
    this.root = root;
  }

  public boolean accept(DateTime time) {
    boolean rs = false;
    if (time == null) {
      return rs;
    }
    rs = TimePeriodUtils.isInSameMonth(root, time);
    return rs;
  }
}
